/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package xcore.constraint.util;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

import xcore.constraint.*;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see xcore.constraint.ConstraintPackage
 * @generated
 */
public class ConstraintSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static ConstraintPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstraintSwitch() {
		if (modelPackage == null) {
			modelPackage = ConstraintPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case ConstraintPackage.XINT_VAR: {
				XIntVar xIntVar = (XIntVar)theEObject;
				T result = caseXIntVar(xIntVar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XINT_VAR_EXPR: {
				XIntVarExpr xIntVarExpr = (XIntVarExpr)theEObject;
				T result = caseXIntVarExpr(xIntVarExpr);
				if (result == null) result = caseXIntExpr(xIntVarExpr);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XSUM: {
				XSum xSum = (XSum)theEObject;
				T result = caseXSum(xSum);
				if (result == null) result = caseXIntVarExpr(xSum);
				if (result == null) result = caseXIntExpr(xSum);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XNEG: {
				XNeg xNeg = (XNeg)theEObject;
				T result = caseXNeg(xNeg);
				if (result == null) result = caseXIntVarExpr(xNeg);
				if (result == null) result = caseXIntExpr(xNeg);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XSCALAR: {
				XScalar xScalar = (XScalar)theEObject;
				T result = caseXScalar(xScalar);
				if (result == null) result = caseXIntVarExpr(xScalar);
				if (result == null) result = caseXIntExpr(xScalar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XCONSTRAINT: {
				XConstraint xConstraint = (XConstraint)theEObject;
				T result = caseXConstraint(xConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XBASIC_CONSTRAINT: {
				XBasicConstraint xBasicConstraint = (XBasicConstraint)theEObject;
				T result = caseXBasicConstraint(xBasicConstraint);
				if (result == null) result = caseXConstraint(xBasicConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XEQ: {
				XEQ xeq = (XEQ)theEObject;
				T result = caseXEQ(xeq);
				if (result == null) result = caseXBasicConstraint(xeq);
				if (result == null) result = caseXConstraint(xeq);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XNEQ: {
				XNEQ xneq = (XNEQ)theEObject;
				T result = caseXNEQ(xneq);
				if (result == null) result = caseXBasicConstraint(xneq);
				if (result == null) result = caseXConstraint(xneq);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XLEQ: {
				XLEQ xleq = (XLEQ)theEObject;
				T result = caseXLEQ(xleq);
				if (result == null) result = caseXBasicConstraint(xleq);
				if (result == null) result = caseXConstraint(xleq);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XLT: {
				XLT xlt = (XLT)theEObject;
				T result = caseXLT(xlt);
				if (result == null) result = caseXBasicConstraint(xlt);
				if (result == null) result = caseXConstraint(xlt);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XINT_CST: {
				XIntCst xIntCst = (XIntCst)theEObject;
				T result = caseXIntCst(xIntCst);
				if (result == null) result = caseXIntCstExpr(xIntCst);
				if (result == null) result = caseXIntExpr(xIntCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XINT_VAR_REF: {
				XIntVarRef xIntVarRef = (XIntVarRef)theEObject;
				T result = caseXIntVarRef(xIntVarRef);
				if (result == null) result = caseXIntVarExpr(xIntVarRef);
				if (result == null) result = caseXIntExpr(xIntVarRef);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XINT_CST_EXPR: {
				XIntCstExpr xIntCstExpr = (XIntCstExpr)theEObject;
				T result = caseXIntCstExpr(xIntCstExpr);
				if (result == null) result = caseXIntExpr(xIntCstExpr);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XADD: {
				XAdd xAdd = (XAdd)theEObject;
				T result = caseXAdd(xAdd);
				if (result == null) result = caseXIntCstExpr(xAdd);
				if (result == null) result = caseXIntExpr(xAdd);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XSUB: {
				XSub xSub = (XSub)theEObject;
				T result = caseXSub(xSub);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XMULT: {
				XMult xMult = (XMult)theEObject;
				T result = caseXMult(xMult);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XDIV: {
				XDiv xDiv = (XDiv)theEObject;
				T result = caseXDiv(xDiv);
				if (result == null) result = caseXIntCstExpr(xDiv);
				if (result == null) result = caseXIntExpr(xDiv);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XPPCM: {
				XPpcm xPpcm = (XPpcm)theEObject;
				T result = caseXPpcm(xPpcm);
				if (result == null) result = caseXIntCstExpr(xPpcm);
				if (result == null) result = caseXIntExpr(xPpcm);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XINT_EXPR: {
				XIntExpr xIntExpr = (XIntExpr)theEObject;
				T result = caseXIntExpr(xIntExpr);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.XINT_CST_REF: {
				XIntCstRef xIntCstRef = (XIntCstRef)theEObject;
				T result = caseXIntCstRef(xIntCstRef);
				if (result == null) result = caseXIntCstExpr(xIntCstRef);
				if (result == null) result = caseXIntExpr(xIntCstRef);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Var</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Var</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntVar(XIntVar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Var Expr</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Var Expr</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntVarExpr(XIntVarExpr object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XSum</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XSum</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXSum(XSum object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XNeg</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XNeg</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXNeg(XNeg object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XScalar</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XScalar</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXScalar(XScalar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XConstraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XConstraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXConstraint(XConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XBasic Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XBasic Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXBasicConstraint(XBasicConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XEQ</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XEQ</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXEQ(XEQ object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XNEQ</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XNEQ</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXNEQ(XNEQ object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XLEQ</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XLEQ</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXLEQ(XLEQ object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XLT</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XLT</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXLT(XLT object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntCst(XIntCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Var Ref</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Var Ref</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntVarRef(XIntVarRef object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Cst Expr</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Cst Expr</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntCstExpr(XIntCstExpr object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XAdd</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XAdd</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXAdd(XAdd object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XSub</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XSub</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXSub(XSub object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XMult</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XMult</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXMult(XMult object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XDiv</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XDiv</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXDiv(XDiv object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XPpcm</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XPpcm</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXPpcm(XPpcm object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Expr</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Expr</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntExpr(XIntExpr object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>XInt Cst Ref</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>XInt Cst Ref</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseXIntCstRef(XIntCstRef object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //ConstraintSwitch
